package com.ruoyi.web.wx.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.user.domain.User;
import com.ruoyi.user.domain.vo.ExpertLoginVO;
import com.ruoyi.wx.service.WxLoginService;
import com.ruoyi.wx.utils.GetUserUtils;
import com.ruoyi.wx.vo.WxLoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "登录")
@RestController
@RequestMapping("/wx")
public class WxLoginController {

    @Autowired
    private WxLoginService wxLoginService;
    @PostMapping("/login")
    @ApiOperation("微信登录")
    public AjaxResult login(@RequestBody WxLoginVo wxLoginVo) {
        return wxLoginService.wxLogin(wxLoginVo);
    }

    @ApiOperation("微信登出")
    @PostMapping("/logout")
    public AjaxResult logout(HttpServletRequest request) {
        return wxLoginService.logout(request);
    }

    @ApiOperation("专家登录")
    @PostMapping("/expertLogin")
    public AjaxResult expertLogin(@RequestBody ExpertLoginVO expertLoginVO) {
        return wxLoginService.expertLogin(expertLoginVO);
    }

    @ApiOperation("专家登出")
    @PostMapping("/expertLogout")
    public AjaxResult expertLogout(HttpServletRequest request) {
        return wxLoginService.logout(request);
    }

    @ApiOperation("用户端邀请码生成")
    @PostMapping("/QRCodeLogin")
    public AjaxResult QRCodeLogin(@RequestBody WxLoginVo wxLoginVo) {
        return wxLoginService.QRCodeLogin(wxLoginVo);
    }

}
